﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ArgusLib.Threading
{
	public class SynchronizedObject<T>
		where T : struct
	{
		protected T _Object;
		protected object _lock;

		public SynchronizedObject(T value)
		{
			this._Object = value;
			this._lock = new object();
		}

		public SynchronizedObject()
			: this(default(T))
		{
		}

		public T Object
		{
			get
			{
				lock (this._lock)
				{
					return this._Object;
				}
			}
			set
			{
				lock (this._lock)
				{
					this._Object = value;
				}
			}
		}
	}
}
